const HtmlWebpackPlugin = require('html-webpack-plugin')//生成html
const path = require('path')
module.exports = {
    entry: { //多入口：有几个入口生成几个
        mian: './a.js',
        test: './b.js'
    },
    output: {
        filename: 'js/[name].[contenthash].js',//增加哈希值 解决服务器缓存问题
        path: path.resolve(__dirname, 'dist')
    },
    module: {

    },
    plugins: [
        new HtmlWebpackPlugin({
            template: "./index.html",
            minify: {
                collapseWhitespace: true,//移除空格
                removeComments: true//移除注释
            }
        }),
    ],
    mode: 'production'//生成环境会自动压缩js代码
}
